package cn.mumzone.pos.ui.adapter.warehouse;

import cn.mumzone.basic.adapter.rv.ItemViewDelegate;
import cn.mumzone.basic.adapter.rv.ViewHolder;
import cn.mumzone.pos.AppConstants;
import cn.mumzone.pos.R;
import cn.mumzone.pos.model.OutWarehouseDetailEntity;
import cn.mumzone.pos.model.WarehouseDetailEntity;

/**
 * Created By Dlx
 * on 2019/10/10
 */
public class ItemView_ShortWarehouseDetail_Out implements ItemViewDelegate<OutWarehouseDetailEntity.GoodsListBean> {

    @Override
    public int getItemViewLayoutId() {
        return R.layout.item_warehouse_short_out;
    }

    @Override
    public boolean isForViewType(OutWarehouseDetailEntity.GoodsListBean item, int position) {
        //todo 无批次时返回true
        return "0".equals(item.getIsBatch());
    }

    @Override
    public void convert(ViewHolder holder, OutWarehouseDetailEntity.GoodsListBean entity, int position) {

        holder.setText(R.id.tv_good_name, entity.getGoodsName());
        holder.setText(R.id.tv_good_unit, entity.getGoodsSpec());
        holder.setText(R.id.tv_good_num, entity.getGoodsBatchNumList().get(0).getGoodsNum() + entity.getGoodsBatchNumList().get(0).getGoodsUnit());
    }
}
